<template>
	<view class="service"  v-for="(item,index) in serviceList" :key="index" @click="bindServiceInfo(item)">
		<image :src="item.imgUrl" class="pic" mode=""></image>
		<view class="right">
			<view class="top">
				<text>{{item.name}}</text>
				<image src="../../static/right.png" mode=""></image>
			</view>
			<view class="bottom">
				<text class="amount">￥{{item.salePrice}}</text>
				<text class="unamount">￥{{item.initPrice}}</text>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {

		getManyProductInfo
	} from '@/api'
	import {
		onLoad,
		onReachBottom,
		onShow,
	} from '@dcloudio/uni-app'
	import {
		ref
	} from 'vue';
	const serviceList = ref()
	onLoad((params) => {
		getData(params.storeId)
	})
	const getData = async(storeId)=>{
		const service = await getManyProductInfo({
			storeId: storeId,
			businessType: "4"
		})
		serviceList.value = service.result
	}
	/** 服务详情 */
	const bindServiceInfo = (item)=>{
		uni.navigateTo({
			url:"/pages/serviceInfo/serviceInfo?id="+item.id
		})
	}
</script>

<style lang="scss">
	page {
		background: #F8F5F0;
		padding-bottom: constant(safe-area-inset-bottom); /*兼容 IOS<11.2*/
		padding-bottom: env(safe-area-inset-bottom); /*兼容 IOS>11.2*/
	}
	.service{
		width: 630rpx;
		padding: 36rpx;
		background: #FFFFFF;
		border-radius: 36rpx;
		display: flex;
		margin: 18rpx auto;
		.pic{
			background: pink;
			display: block;
			width: 178rpx;
			height: 178rpx;
			background: #EDEDED;
			margin-right: 24rpx;
		}
		.right{
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			flex: 2;
			.top{
				
				display: flex;
				justify-content: space-between;
				align-items: center;
				text{
					font-weight: bold;
					font-size: 30rpx;
					color: #16191B;
				}
				image{
					display: block;
					width: 38rpx;
					height: 38rpx;
				}
			}
			.bottom{
				.amount{
					
					font-weight: bold;
					font-size: 36rpx;
					color: #ED4538;
					margin-right: 18rpx;
				}
				.unamount{
					font-size: 26rpx;
					color: #A1A1A1;
					text-decoration: line-through;
				}
			}
		}
		
	}
</style>